<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>editMonitor</title>
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
</head>
<body>
    <div th:fragment="editMonitorCode">
        <div style="padding:10px 60px 20px 60px">
            <form id="ff" method="post">
                <table >
                    <tr>
                        <td>检测程序ID:</td>
                        <td><input class="easyui-textbox " type="text" name="monitorcodeId" readonly="true" ></input></td>
                    </tr>
                    <tr>
                        <td>检测程序描述:</td>
                        <td><input class="easyui-textbox" type="text" name="monitorcodeDesc" data-options="required:true"></input></td>
                    </tr>
                    <tr>
                        <td>监视对象类型:</td>
                        <td>
                            <select id='sele-monitorobjType' class="easyui-combobox" name="monitorobjType" data-options="required:true">
                                <option value="webServiceAccess">web接口服务可访问性</option>
                                <option value="portAccess">端口可访问性</option>
                                <option value="ipAccess">ip可访问性</option>
                                <option value="databaseAccess">数据库可访问性</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>ipAddress:</td>
                        <td><input class="easyui-textbox" type="text" name="ipAddress" ></input></td>
                    </tr>
                    <tr>
                        <td>port端口:</td>
                        <td><input class="easyui-textbox" type="text" name="netport" ></input></td>
                    </tr>
                    <tr>
                        <td>url:</td>
                        <td><input class="easyui-textbox" type="text" name="url" ></input></td>
                    </tr>
                    <tr>
                        <td>数据库类型:</td>
                        <td>
                            <select id='sele-databaseType' class="easyui-combobox" name="databaseType" >
                                <option value="mysql">mysql</option>
                                <option value="oracle">oracle</option>
                                <option value="postgresql">postgresql</option>
                                <option value="sqlserver">sqlserver</option>
                                <option value="db2">db2</option>
                                <option value="hive">hive</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>其他信息（json）:</td>
                        <td><input class="easyui-textbox" type="text" name="otherinfo"></input></td>
                    </tr>
                    <tr>
                        <td>备注:</td>
                        <td><input class="easyui-textbox" type="text" name="remark" ></input></td>
                    </tr>
                </table>
            </form>
            <div style="text-align:center;padding:5px">
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">保存</a>
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">清空</a>
               <!-- <a href="javascript:void(0)" class="easyui-linkbutton" onclick="testsetvalue()">设置值</a>-->
            </div>
        </div>
        <script >
            $('#ff').form({
                url:"saveMonitorCode",
                success:function(data){
                    console.log(data);
                    alert("保存成功！");
                    reloadGrid();
                    $('#editMonitorCodeWin').dialog('close')
                }
            });
            function submitForm(){
                //$('#ff').form('submit');
                $.ajax({
                    url:'saveMonitorCode',
                    method:"post",
                    data:{
                        monitorcodeId:$("input[name='monitorcodeId']").val(),
                        monitorcodeDesc:$("input[name='monitorcodeDesc']").val(),
                        monitorobjType:$("#sele-monitorobjType").combobox("getValue"),
                        ipAddress:$("input[name='ipAddress']").val(),
                        netport:$("input[name='netport']").val(),
                        url:$("input[name='url']").val(),
                        databaseType:$("#sele-databaseType").combobox("getValue"),
                        otherinfo:$("input[name='otherinfo']").val(),
                        remark:$("input[name='remark']").val()
                    },
                    success:function(data){
                        if(data.serviceSuccess){
                            alert("保存成功！");
                            reloadGrid();
                            //console.log("成功：",data);
                        }else{
                            alert("保存失败！"+data.errorMsg);
                            //reloadGrid();
                        }
                    },

                });
            }
            function clearForm(){
                $('#ff').form('clear');
            }
            function testsetvalue(){
                $('#ff').form('load',{
                    monitorobjId:"0000",
                    monitorobjName:"0000",
                    monitorobjType:"portAccess",
                });
            }
        </script>
    </div>
</body>
</html>
<script>



</script>
